package cn.ad.service;

import cn.ad.handler.SqlSessionHandler;
import cn.ad.model.CreativeFormatMaterialSpecModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 非原生创意形式素材规格 服务层实现
 * 
 * @author yujuan.zhang
 * @from 2016-06-17
 * @since V1.0
 *
 */
@Service
public class CreativeFormatMaterialSpecService {

	@Autowired
	private SqlSessionHandler sqlSessionHandler;

	/**
	 * 获取非原生创意形式素材规格列表
	 */
	public List<CreativeFormatMaterialSpecModel> getMaterialSpecList() {
		return sqlSessionHandler.selectList("creativeFormatMaterialSpecMapper.materialFormat:list", null);
	}

	public int selectCountByFormatIdSizeId(Integer formatId, Integer adSizeId) {
		Map<String, Integer> mapParams = new HashMap<>();
		mapParams.put("formatId", formatId);
		mapParams.put("adSizeId", adSizeId);
		return sqlSessionHandler.selectOne("creativeFormatMaterialSpecMapper.select:count:by:formatId:sizeId", mapParams);
	}

}
